package com.lwj.mallchat.common.common.exception;

import com.lwj.mallchat.common.common.domain.enums.CommonErrorEnum;
import lombok.Data;

/**
 * @author lwj
 * @ClassName BusinessException
 * @date 2024/10/20 16:45
 */
@Data
public class BusinessException extends RuntimeException {
    protected Integer errorCode;
    protected String errorMsg;

    public BusinessException(String errorMsg) {
        super(errorMsg);
        this.errorMsg = errorMsg;
        this.errorCode = CommonErrorEnum.BUSINESS_ERROR.getErrorCode();
    }

    public BusinessException(Integer errorCode, String message) {
        super(message);
        this.errorMsg = message;
        this.errorCode = errorCode;
    }


    public BusinessException(CommonErrorEnum lockLimit) {
        super(lockLimit.getErrorMsg());
        this.errorCode = lockLimit.getErrorCode();
        this.errorMsg = lockLimit.getErrorMsg();
    }
}
